{% extends "element/saas/statistics/statistics_base.html" %}

{% block meta_title %}进出口分析{% endblock %}

{% block chart %}{% endblock %}

{% block sx %}
    <div id="pietype">
        <span class="ptype c1">进口总额</span>
        <span class="ptype c0 inactive">出口总额</span>
    </div>
{% endblock %}

{% block table %}
    <h4 class="report-title" id="monthText">进出口月度详情</h4>
    <table class="basictable" id="monthTable"></table>
{% endblock %}

{% block htmljs %}
    <script>
        mini.parse();
        var tabs = mini.get("mainTabs");
        $(function () {
            ajaxchart("", "");
        });
        slengedtext = "进口总额", maplegendtext = "进口总额", tablehead = "hg";
        var selectregion = "", selectnic = "";
        //ajax
        function ajaxchart(region, nic, maptype, date) {
            selectregion = region;
            selectnic = nic;
            if (!date) {
                date = "";
            }
            maptype = jQuery.parseJSON(json1)[maptype];
            $.ajax({
                type: 'POST',
                url: '/saas/statistics_hg/',
                data: {
                    region: region,
                    nic: nic,
                    tmonth: date
                },
                success: function (data) {
                    chartautoSize(0);
                    drawhighstock(data, maptype);
                }
            });
            var tabname = tabs.getActiveTab().name;
            if (tabname == "comlist") {
                tabs.activeTab(0);
            }
        }
        tabs.on("activechanged", function (e) {
            var index = e.index;
            if (index == 2) {
                var tab = tabs.getActiveTab();
                var taburl = tab.url;
                var url = "/saas/statistics_bangdan/?sortfiled=timport&region=" + selectregion + "&nic=" + selectnic;
                if (url != taburl) {
                    tabs.loadTab(url, tab, ahei);
                }
            }
        });
        function ahei() {
            var tab = tabs.getActiveTab();
            var iframe = tabs.getTabIFrameEl(tab);
            iframe.style.height = "1600px";
        }
    </script>
{% endblock %}
